<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CustomerConfigTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('customer_city', array('engine' => 'MyISAM', 'comment' => '客户城市表'));
        $table->addColumn('parent_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '父级id'))
            ->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('type', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '地区所处的层级'))
            ->addColumn('district_sqe', 'string', array('limit' => 255,'null' => true, 'comment' => '地区所处的层级'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_status', array('engine' => 'MyISAM', 'comment' => '客户状态表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_type', array('engine' => 'MyISAM', 'comment' => '客户类别表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_level', array('engine' => 'MyISAM', 'comment' => '客户等级表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_source', array('engine' => 'MyISAM', 'comment' => '客户来源表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_ripe', array('engine' => 'MyISAM', 'comment' => '客户成熟度表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_industry', array('engine' => 'MyISAM', 'comment' => '客户行业表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_intention', array('engine' => 'MyISAM', 'comment' => '客户意向产品表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '名字'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();

        $table = $this->table('customer_appendix', array('engine' => 'MyISAM', 'comment' => '客户附件表'));
        $table->addColumn('name', 'string', array('limit' => 55, 'null' => true, 'comment' => '文件名字'))
            ->addColumn('path', 'string', array('limit' => 255, 'null' => true, 'comment' => '文件路径'))
            ->addColumn('customer_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '客户id'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
